from django.shortcuts import render, get_object_or_404
from .models import ScenicSpot

def scenic_list(request):
    spots = ScenicSpot.objects.all().order_by('-created_at')
    return render(request, 'scenic/list.html', {'spots': spots})

def scenic_detail(request, slug):
    spot = get_object_or_404(ScenicSpot, slug=slug)
    return render(request, 'scenic/detail.html', {'spot': spot})